package com.bj58.data.emailreports.utils;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.bj58.wf.dal.annotation.Column;

/**公用方法模块
 * @author Administrator
 *
 */
public class SomePublicUtil {
	
	/**通过Column注解获取vo字段中英文字典，以,号隔开（英,中)
	 * @param <T>
	 * @param clazz
	 * @return
	 */
	public <T>List<String>  getECDicByAnnotation(Class<T> clazz){
		List<String>  rsList = new ArrayList<String>();
		Field[] fds = clazz.getDeclaredFields();
        for (Field fd : fds) {  
            /* 
             * 判断方法中是否有指定注解类型的注解 
             */  
            boolean hasAnnotation = fd.isAnnotationPresent(Column.class);  
            if (hasAnnotation) {  
                /* 
                 * 根据注解类型返回方法的指定类型注解 
                 */  
            	Column annotation = fd.getAnnotation(Column.class);
            	rsList.add(fd.getName()+","+annotation.value());
            }  
        }  
        return rsList;
	}
	
	public  static void emailWarn(String content){
		String title = "Error!!~"+ DateUtil.getStringDate(new Date(), "yyyy-MM-dd HH:mm");
		MailUtil.javaMailSend(title, content, "huangliang@58.com",null);
	}
}

